package main

import "fmt"

func test02(arr *[3]int) {
	(*arr)[0] = 88
}
func test(arr [3]int) {
	arr[2] = 99
}
func main() {
	//var score [5]float64
	//for i:=0;i<len(score) ;i++  {
	//	fmt.Printf("请输入第%d个元素值\n",i+1)
	//	fmt.Scanln(&score[i])
	//}
	//for i:=0;i<len(score) ;i++  {
	//	fmt.Printf("第%d个元素的值为%f\n",i+1,score[i])
	//}
	//4种初始化数组的方式
	//var numArr01 [3]int = [3]int{1,2,3}
	//fmt.Println("numArr01=",numArr01)
	//var numArr02 = [3]int{5,6,7}
	//fmt.Println("numArr02=",numArr02)
	//var numArr03 = [...]int{7,8,9}
	//fmt.Println("numArr03=",numArr03)
	//var numArr04 = [...]int{1:800,0:900,2:999}
	//fmt.Println("numArr04=",numArr04)
	//strArr05 := [...]string{1:"abc",2:"summer",0:"cde"}
	//fmt.Println("strArr05=",strArr05)
	//go独有的遍历数组 for-range index/value 可以用_省略
	//var heroes [3]string = [3]string{"宋江", "吴用", "武松"}
	//fmt.Println(heroes)
	//for index, value := range heroes {
	//	fmt.Printf("index=%v,value=%v\n", index, value)
	//}
	arr := [3]int{11, 22, 33}
	test(arr)
	fmt.Println(arr)
	test02(&arr)
	fmt.Println(arr)
}
